package com.ccc.demoboot.common;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @Author wz
 * @Date 2024/5/16 9:34
 * @PackageName:com.ccc.demoboot.common
 * @ClassName: R全局统一返回对象
 */
public class R {
    private int code=200;//成功
    private String message="操作成功";
     private Map<String,Object> data=new LinkedHashMap<>();


    /**
     * 往map中追加对象
     * @param key
     * @param value
     * @return
     */
    public R add(String key, Object value){
        this.data.put(key,value);
        //链式调用
        return this;
    }

    public int getCode() {
        return code;
    }

    public R setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public R setMessage(String message) {
        this.message = message;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }



}
